home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / faq / vol15n14.zip / DDGAME.ZIP / ANIM.H < prev    next >
C/C++ Source or Header  |  1996-02-24  |  2KB  |  68 lines

  1. // animation.h : header file for CAnimation class
  2. //
  3. #ifndef __ANIMATION_H
  4. #define __ANIMATION_H
  5.  
  6. #include "ddraw.h"
  7.  
  8. class CAnim
  9. {
  10.   protected:
  11.     static int DisplayWidth;
  12.   public:
  13.     static void SetDisplayWidth(int nDisplayWidth);
  14.  
  15.   public:
  16.     CAnim(LPDIRECTDRAW pDirectDraw,
  17.           char* pFileRoot,
  18.           char* pDirectoryName,
  19.           int nNumFrames,
  20.           BOOL bStoreInVideo = TRUE);
  21.     // Default constructor, does not actually allocate memory or load images,
  22.     // just sets up internal data
  23.  
  24.     virtual ~CAnim();
  25.  
  26.     BOOL Load();
  27.     // actually allocates storage memory and reads image files
  28.  
  29.     void Release();
  30.     // releases the direct draw surface, call this is your CGameFrame 
  31.     // descendents KillGraphics function
  32.  
  33.     BOOL Restore();
  34.     // calls ddraw restore function on surface, and reloads images from disk
  35.  
  36.     HRESULT Render(int nX, 
  37.                    int nY,
  38.                    int nFrameNum,
  39.                    LPDIRECTDRAWSURFACE pDestSurface,
  40.                    BOOL bTransparent = TRUE);
  41.     // calls ddraw BltFast function
  42.  
  43.     int GetNumFrames() {return m_nNumFrames;};
  44.     int GetWidth() {return m_nWidth;};
  45.     int GetHeight() {return m_nHeight;};
  46.     
  47.   protected:
  48.     BOOL InternalLoad(BOOL bRestore);
  49.  
  50.     LPDIRECTDRAW m_pDirectDraw;
  51.  
  52.     LPDIRECTDRAWSURFACE m_pSurface;
  53.  
  54.     char* m_pFileRoot;
  55.     int m_nNumFrames;
  56.     BOOL m_bInVideo;
  57.  
  58.     int m_nWidth;   // Width of one frame
  59.     int m_nHeight;  // Height of one frame
  60.  
  61.     int m_nNumRows;
  62.     int m_nNumCols;
  63.  
  64.     int* m_pnRows;
  65.     int* m_pnCols;
  66. };
  67.  
  68. #endif // __ANIMATION_H